<template>
  <div class="app-container">
    <!--工具栏-->
    <div class="head-container">
      <!--通用查询-->
      <queryHeader :dict="dict" :permission="permission" />
      <!--通用编辑-->
      <crudOperation :permission="permission" />
    </div>

    <!--表格渲染-->
    <el-table ref="table" v-loading="crud.loading" :data="crud.data" style="width: 100%;" @selection-change="crud.selectionChangeHandler">
      <!--多选框-->
      <el-table-column type="selection" width="55" />
      <!--展示字段-->
      <el-table-column v-if="columns.visible('id')" prop="id" label="id" :show-overflow-tooltip="true" />
      <el-table-column v-if="columns.visible('filterSign')" prop="filterSign" label="过滤标识" :show-overflow-tooltip="true" />
      <el-table-column v-if="columns.visible('filterUrl')" prop="filterUrl" label="过滤路径" :show-overflow-tooltip="true" />
      <el-table-column v-if="columns.visible('filterUrlMethod')" prop="filterUrlMethod" label="请求方式" :show-overflow-tooltip="true">
        <template slot-scope="scope">
          {{ dict.label.type_common_http_method[scope.row.filterUrlMethod] }}
        </template>
      </el-table-column>
      <el-table-column v-if="columns.visible('filterParams')" prop="filterParams" label="过滤参数" :show-overflow-tooltip="true" />
      <el-table-column v-if="columns.visible('keyTypeAlias')" prop="keyTypeAlias" label="关键词类型别名" :show-overflow-tooltip="true" />
      <el-table-column v-if="columns.visible('isReplace')" prop="isReplace" label="是否替换" :show-overflow-tooltip="true">
        <template slot-scope="scope">
          {{ dict.label.status_common_yesno[scope.row.isReplace] }}
        </template>
      </el-table-column>

      <!--操作-->
      <el-table-column label="操作" width="130px" align="center" fixed="right">
        <template slot-scope="scope">
          <!--通用编辑删除-->
          <udOperation :data="scope.row" :permission="permission" />
        </template>
      </el-table-column>
    </el-table>

    <!--分页组件-->
    <pagination />

    <!--表单渲染-->
    <editForm :dict="dict" />
  </div>
</template>

<script>
import crudGwKwFilter from '@/api/system/gateway/keyword/filter'
import queryHeader from './module/queryHeader'
import editForm from './module/editForm'
import CRUD, { presenter } from '@crud/crud'
import crudOperation from '@crud/CRUD.operation'
import pagination from '@crud/Pagination'
import udOperation from '@crud/UD.operation'

// crud交由presenter持有
const crud = CRUD({ title: 'GwKwFilter', url: 'gw/kw/filter/list/page', crudMethod: { ...crudGwKwFilter }, pkIdName: 'id' })

export default {
  name: 'GwKwFilter',
  components: { queryHeader, editForm, crudOperation, pagination, udOperation },
  dicts: ['type_common_http_method', 'status_common_yesno'],
  mixins: [presenter(crud)],
  data() {
    return {
      // 对应几个按钮操作
      permission: {
        add: [],
        edit: [],
        del: []
      }
    }
  },
  methods: {

  }
}
</script>

<style rel="stylesheet/scss" lang="scss" scoped>
  /deep/ .el-input-number .el-input__inner {
    text-align: left;
  }
</style>
